import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'  //静态导入

//路由懒加载
const Home = () => import(/* webpackChunkName: "Home" */ '../views/Home.vue')

const index = () => import(/* webpackChunkName: "Home" */ '../views/index.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: index,
    redirect: '/home',
    children: [
      {
        path: 'home',
        name: 'Home',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home.vue')
      },
      {
        path: 'goods',
        name: 'goods',
        component: () => import(/* webpackChunkName: "about" */ '../views/goods.vue')
      },
      {
        path: 'about',
        name: 'About',
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
      },
      {
        path: 'xiangq',
        name: 'xiangq',
        component: () => import(/* webpackChunkName: "about" */ '../views/xiangq.vue')
      },
      {
        path: 'wu',
        name: 'wu',
        component: () => import(/* webpackChunkName: "about" */ '../views/wu.vue')
      },
      {
        path: 'order',
        name: 'order',
        component: () => import(/* webpackChunkName: "about" */ '../views/order.vue')
      },
    ]
    

  },





  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  // {
  //   path: '*',
  //   redirect: '/login'
  // },
]
const router = new VueRouter({
  routes
})
//路由守卫-进行全局路由拦截




export default router
